package com.etl.plugin.datasource.pool.impl;

import com.etl.base.DataSourceInfo;
import com.etl.plugin.datasource.pool.abs.BaseAbsPool;
import org.apache.poi.ss.formula.functions.T;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * mysql链接
 *
 * 针对数据源实体类操作
 */
public class MysqlConnectionPool extends BaseAbsPool<Connection> {


    /**
     * 新建连接
     * @param dataSourceInfo
     * @return
     */
    @Override
    public Connection newConn(DataSourceInfo dataSourceInfo) {
        //        dataSourceInfo -》获取 url ，password username
        try {
            return  DriverManager.getConnection("");
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 关闭
     * @param conn
     */
    @Override
    public void closeConn(Connection conn) {

        if (conn!=null){
            try {
                conn.close();
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }
    }


}
